#include <cstdlib>
#include <string>
#include <iostream>
#include <vector>
#include <pcap.h>

#include "includes/config.h"
#include "includes/scanner.h"

#include "includes/adjacencia.h"
#include "includes/info.h"

using namespace std;

void onExit()
{
	Info *info = Info::getInstance();

	cout <<
			"Tempo de execução:        " << info->getExecutionTime()   << endl <<
			"Hospedeiros na rede:      " << info->nmHosts              << endl <<
			"Gerenciadores de sessões: " << info->nmSessionManagers    << endl <<

			"Sessões UDP:              " << info->nmUdpSessions        << endl <<
			"Sessões TCP:              " << info->nmTcpSessions        << endl <<
			"Sessões ICMP:             " << info->nmIcmpSessions       << endl <<
			"Sessões ICMP de erro:     " << info->nmIcmpErrorSessions  << endl <<

			"Pacotes capturados:       " << info->nmCapturedPackets    << endl <<
			"Pacotes descartados:      " << info->nmDiscartedPackets   << endl <<
	        "Pacotes TCP descartados:  " << info->nmDicartedTcpPackets << endl;
}

int main(int argc, char **argv)
{
	atexit(onExit);

	Config config(new string("/etc/dunadan/dunadan.conf"), new Input(argc, argv));

	Scanner scan(&config);

	scan.scan();

	return 0;
}

